<div class="dialog">
    <table>
        <tbody>
        
            <tr class="prop">
                <td valign="top" class="name"><g:message code="distribution.serialNumber" default="Serial Number" />:</td>
                <td valign="top" class="value">${fieldValue(bean: distributionInstance, field: "serialNumber")}</td>
            
                <td valign="top" class="name"><g:message code="distribution.retailer" default="Retailer" />:</td>
                <td valign="top" class="value">
                    <g:link controller="retailer" action="show" id="${distributionInstance?.retailer?.id}">${distributionInstance?.retailer?.encodeAsHTML()}</g:link>
                </td>
            
                <td valign="top" class="name"><g:message code="distribution.date" default="Date" />:</td>
                <td valign="top" class="value"><g:formatDate date="${distributionInstance?.date}" format="yyyy-MM-dd" /></td>
            </tr>
            
            <tr class="prop">
                <td valign="top" class="name"><g:message code="distribution.maker" default="Maker" />:</td>
                <td valign="top" class="value">
                    <g:link controller="staff" action="show" id="${distributionInstance?.maker?.id}">${distributionInstance?.maker?.encodeAsHTML()}</g:link>
                </td>
            
                <td valign="top" class="name"><g:message code="distribution.driver" default="Driver" />:</td>
                <td valign="top" class="value">
                    <g:link controller="staff" action="show" id="${distributionInstance?.driver?.id}">${distributionInstance?.driver?.encodeAsHTML()}</g:link>
                </td>

                <td valign="top" class="name"><g:message code="distribution.approved" default="Approved" />:</td>
                <td valign="top" class="value">
                    <g:formatBoolean boolean="${distributionInstance?.approved}" />
                </td>
            </tr>
            
            <tr class="prop">
                <td valign="top" class="name"><g:message code="distribution.dateCreated" default="Date Created" />:</td>
                <td valign="top" class="value"><g:formatDate date="${distributionInstance?.dateCreated}" format="yyyy-MM-dd HH:mm:ss"/></td>

                <td valign="top" class="name"><g:message code="distribution.lastUpdated" default="Last Updated" />:</td>
                <td valign="top" class="value"><g:formatDate date="${distributionInstance?.lastUpdated}" format="yyyy-MM-dd HH:mm:ss"/></td>

                <td valign="top" class="name">&nbsp;</td>
                <td valign="top" class="value">
                    &nbsp;
                </td>
             </tr>
            
        </tbody>
    </table>
</div>
<!--detail-->
<div class="list">
    <table>
        <thead>
            <tr>
                <th><g:message code="distributionDetail.serialNumber" default="Serial Number" /></th>
                <th><g:message code="distributionDetail.product" default="Product" /></th>
                <th><g:message code="distributionDetail.unit" default="Unit" /></th>
                <th class="number"><g:message code="distributionDetail.quantity" default="Quantity" /></th>
                <th class="number"><g:message code="distributionDetail.sended" default="Sended" /></th>
                <th class="number"><g:message code="distributionDetail.price" default="Price" /></th>
                <th class="number"><g:message code="distributionDetail.retailPrice" default="Retail Price" /></th>
                <th class="number"><g:message code="distributionDetail.amount" default="Amount" /></th>
                <th class="number"><g:message code="distributionDetail.retailAmount" default="Retail Amount" /></th>
                <th><g:message code="distributionDetail.packages" default="Packages" /></th>
                <th class="number"><g:message code="distributionDetail.packageUsed" default="Package Used" /></th>
                <th class="number"><g:message code="distributionDetail.packageReturned" default="Package Returned" /></th>
             </tr>
        </thead>
        <tbody>
        <g:each in="${distributionInstance?.details?.sort{it?.serialNumber}}" status="i" var="distributionDetailInstance">
            <tr class="${(i % 2) == 0 ? 'odd' : 'even'}">
                <td>${fieldValue(bean: distributionDetailInstance, field: "serialNumber")}</td>
                <td>${fieldValue(bean: distributionDetailInstance, field: "product")}</td>
                <td>${fieldValue(bean: distributionDetailInstance, field: "unit")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "quantity")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "sended")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "price")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "retailPrice")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "amount")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "retailAmount")}</td>
                <td>${fieldValue(bean: distributionDetailInstance, field: "packages")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "packageUsed")}</td>
                <td class="number">${fieldValue(bean: distributionDetailInstance, field: "packageReturned")}</td>
             </tr>
        </g:each>
        </tbody>
    </table>
</div>
